package com.example.spring.collection;


import com.example.spring.config.Feifen;
import com.examppl.spring.entity.Collect;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

@RestController
@Api(value = "收长表")
public class CollerCollection {
   @Autowired
   Feifen feifen;
    @ApiOperation(value = "查询",notes = "收藏美食")
    @ApiResponses({@ApiResponse(code = 400,message = "参数没有填好"),
            @ApiResponse(code = 404,message = "页面跳装错误"),})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId",value = "用户id",required = true,dataType = "int"),
            @ApiImplicitParam(name = "foodId",value = "美食id",required = true,dataType = "int"),
    })
    //根据用户id给美食搜藏
    @RequestMapping(value = "userFood",method = RequestMethod.POST)
    @CrossOrigin
    public String  userFood( Collect collect){
     System.out.println(collect.getFoodId()+"+++==   " +collect.getUserId());
        return feifen.userFood(collect);
    }




    @ApiOperation(value = "查询",notes = "我的收藏总数")
    @ApiResponses({@ApiResponse(code = 400,message = "参数没有填好"),
            @ApiResponse(code = 404,message = "页面跳装错误"),})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId",value = "用户id",required = true,dataType = "int"),
    })
    //根据用户userid 收场总数
    @RequestMapping(value = "Sum",method = RequestMethod.POST)
    @CrossOrigin
    public String Sun(Integer userId ){
        return  feifen.Sum( userId );
    }

    @ApiOperation(value = "查询",notes = "我关注的人数")
    @ApiResponses({@ApiResponse(code = 400,message = "参数没有填好"),
            @ApiResponse(code = 404,message = "页面跳装错误"),})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId",value = "用户id",required = true,dataType = "int"),
            @ApiImplicitParam(name = "hotelId",value = "酒店id",required = true,dataType = "int"),
    })
    //根据用户id给酒店点赞
    @CrossOrigin
    @RequestMapping(value = "userHotel",method = RequestMethod.GET)
    public String  userHotel( Collect collect){
        return feifen.userHotel(collect);
    }
}
